/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.games.epkb.entityClasses;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author plebani
 */
@Entity
@Table(name = "network_interface")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NetworkInterface.findAll", query = "SELECT n FROM NetworkInterface n"),
    @NamedQuery(name = "NetworkInterface.findById", query = "SELECT n FROM NetworkInterface n WHERE n.id = :id"),
    @NamedQuery(name = "NetworkInterface.findByIPServer", query = "SELECT n FROM NetworkInterface n WHERE n.iPServer = :iPServer"),
    @NamedQuery(name = "NetworkInterface.findByMACServer", query = "SELECT n FROM NetworkInterface n WHERE n.mACServer = :mACServer"),
    @NamedQuery(name = "NetworkInterface.findByNetworkBroadcast", query = "SELECT n FROM NetworkInterface n WHERE n.networkBroadcast = :networkBroadcast")})
public class NetworkInterface implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private String id;
    @Column(name = "IPServer")
    private String iPServer;
    @Column(name = "MACServer")
    private String mACServer;
    @Column(name = "NetworkBroadcast")
    private String networkBroadcast;
    @JoinColumn(name = "Id_Server", referencedColumnName = "ID")
    @ManyToOne
    private Server idServer;
    @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Component component;

    public NetworkInterface() {
    }

    public NetworkInterface(String id) {
        this.id = id;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIPServer() {
        return iPServer;
    }

    public void setIPServer(String iPServer) {
        this.iPServer = iPServer;
    }

    public String getMACServer() {
        return mACServer;
    }

    public void setMACServer(String mACServer) {
        this.mACServer = mACServer;
    }

    public String getNetworkBroadcast() {
        return networkBroadcast;
    }

    public void setNetworkBroadcast(String networkBroadcast) {
        this.networkBroadcast = networkBroadcast;
    }

    public Server getIdServer() {
        return idServer;
    }

    public void setIdServer(Server idServer) {
        this.idServer = idServer;
    }

    public Component getComponent() {
        return component;
    }

    public void setComponent(Component component) {
        this.component = component;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NetworkInterface)) {
            return false;
        }
        NetworkInterface other = (NetworkInterface) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "it.polimi.games.epkb.entityClasses.NetworkInterface[ id=" + id + " ]";
    }
    
}
